package com.example.simple.factory;
// 工厂类

/**静态方法：获取什么产品*/
public class WeaponFactory {
    public static Weapon get(String WeaponType) {
        if("TANK".equals(WeaponType)) {
            return new Tank();
        }else if("FIGHTER".equals(WeaponType)) {
            return new Fighter();
        }else if("GUN".equals(WeaponType)) {
            return new Gun();
        } else {
            throw new RuntimeException("不支持该武器生产");
        }
    }
}
